﻿#region

using System;
using HouseHoldBudget.Core.Data;

#endregion

namespace HouseHoldBudget.Data
{
    public class EfDataProviderManager : BaseDataProviderManager
    {
        #region Constructors

        public EfDataProviderManager(DataSettings settings) : base(settings)
        {
        }

        #endregion

        #region Instance Methods

        public override IDataProvider LoadDataProvider()
        {
            var providerName = Settings.DataProvider;
            if (String.IsNullOrWhiteSpace(providerName))
                throw new Exception("Data Settings doesn't contain a providerName");

            switch (providerName.ToLowerInvariant())
            {
                case "sqlserver":
                    return new SqlServerDataProvider();
                default:
                    throw new Exception(string.Format("Not supported dataprovider name: {0}", providerName));
            }
        }

        #endregion
    }
}